home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / ConditionalMacros.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  6.1 KB  |  184 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ConditionalMacros.p
  3.  
  4.      Contains:    Compile time feature switches to achieve platform independent sources.
  5.  
  6.      Version:    Technology:    Universal Interface Files 2.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT ConditionalMacros;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __CONDITIONALMACROS__}
  30. {$SETC __CONDITIONALMACROS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC ConditionalMacrosIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36. {
  37.     This file sets up the following compiler independent conditionals:
  38.     
  39.     GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  40.     GENERATING68K            - Compiler is generating 68k family instructions
  41.     GENERATING68881            - Compiler is generating mc68881 floating point instructions
  42.     GENERATINGCFM            - Code being generated assumes CFM calling conventions
  43.     CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  44.     
  45.     SystemSevenFiveOrLater    - Compiled code will only be run on a System 7.5 or later Macintosh
  46.     SystemSevenOrLater        - Compiled code will only be run on a System 7.0 or later Macintosh
  47.     SystemSixOrLater        - Compiled code will only be run on a System 6.0 or later Macintosh
  48.                               A developer should set the appropriate flag on the compiler command-
  49.                               line or in a file processed before this file.  This will allow the
  50.                               certain optimizations to be made which can result in smaller, faster
  51.                               applications.
  52.     
  53.     CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  54.                               are: all lowercase, use C strings instead of pascal strings, use 
  55.                               Point* instead of Point).
  56.  
  57.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  58.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  59.                               are now more sensitive to change because CFM binds by name.  In the 
  60.                               past, system routine names were compiled out to just an A-Trap.  
  61.                               Macros have been added that each map an old name to its new name.  
  62.                               This allows old routine names to be used in existing source files,
  63.                               but the macros only work if OLDROUTINENAMES is true.  This support
  64.                               will be removed in the near future.  Thus, all source code should 
  65.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  66.                               to see if your code has any old names left in it.
  67.     
  68.     OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  69.                               has been moved from Strings to TextUtils.  It is conditionalized in
  70.                               Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  71.                               This allows developers to upgrade to newer interface files without suddenly
  72.                               all their code not compiling becuase of "incorrect" includes.  But, it
  73.                               allows the slow migration of system calls to more understandable file
  74.                               locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  75.                               will default to false.
  76.     
  77.     PRAGMA_ALIGN_SUPPORTED    - Compiler supports "#pragma align=..." directives. The only compilers that
  78.                               can get by without supporting the pragma are old classic 68K compilers
  79.                               that will only be used to compile older structs that have 68K alignment
  80.                               anyways.  
  81.     
  82.     PRAGMA_IMPORT_SUPPORTED    - Compiler supports "#pragma import on/off" directives.  These directives
  83.                               were introduced with the SC compiler which supports CFM 68K.  The directive
  84.                               is used to tell the compiler which functions will be called through a 
  85.                               transition vector (instead of a simple PC-relative offset).  This allows 
  86.                               the compiler to generate better code.  Since System Software functions are
  87.                               implemented as shared libraries and called through transition vectors,
  88.                               all System Software functions are declared with "#pragma import on".
  89.                               
  90.     
  91.     There are some invariants among the conditionals:
  92.     
  93.     GENERATINGPOWERPC != GENERATING68K
  94.     GENERATING68881 => GENERATING68K
  95.     GENERATINGPOWERPC => GENERATINGCFM
  96.     GENERATINGPOWERPC => CFMSYSTEMCALLS
  97.     CFMSYSTEMCALLS => GENERATINGCFM
  98.     GENERATINGPOWERPC => SystemSevenOrLater
  99.     SystemSevenFiveOrLater => SystemSevenOrLater
  100.     SystemSevenOrLater => SystemSixOrLater
  101.     PRAGMA_IMPORT_SUPPORTED => CFMSYSTEMCALLS
  102.     
  103. }
  104. {
  105.  
  106.     Set up UNIVERSAL_INTERFACES_VERSION
  107.     
  108.         0x210 => version 2.1
  109.         This conditional did not exist prior to version 2.1
  110. }
  111. {$SETC UNIVERSAL_INTERFACES_VERSION := $0210}
  112. {
  113.  
  114.     Set up GENERATINGPOWERPC and GENERATING68K
  115.  
  116. }
  117. {$IFC UNDEFINED LSPWRP }
  118. {$SETC LSPWRP := 0}
  119. {$ENDC}
  120. {$IFC UNDEFINED LSP68K }
  121. {$SETC LSP68K := NOT LSPWRP}
  122. {$ENDC}
  123. {$IFC UNDEFINED GENERATINGPOWERPC }
  124. {$SETC GENERATINGPOWERPC := LSPWRP}
  125. {$ENDC}
  126. {$IFC UNDEFINED GENERATING68K }
  127. {$SETC GENERATING68K := LSP68K}
  128. {$ENDC}
  129. {
  130.  
  131.     Set up GENERATING68881 
  132.  
  133. }
  134. {$IFC GENERATING68K AND OPTION(mc68881) }
  135. {$SETC GENERATING68881 := 1 }
  136. {$ENDC}
  137. {$IFC UNDEFINED GENERATING68881 }
  138. {$SETC GENERATING68881 := 0}
  139. {$ENDC}
  140. {
  141.  
  142.     Set up GENERATINGCFM and  CFMSYSTEMCALLS
  143.  
  144. }
  145. {$SETC GENERATINGCFM := GENERATINGPOWERPC}
  146. {$SETC CFMSYSTEMCALLS := GENERATINGPOWERPC}
  147. {
  148.  
  149.     Set up SystemSevenFiveOrLater, SystemSevenOrLater, and SystemSixOrLater
  150.  
  151. }
  152. {$IFC UNDEFINED SystemSevenFiveOrLater }
  153. {$SETC SystemSevenFiveOrLater := 0}
  154. {$ENDC}
  155. {$IFC UNDEFINED SystemSevenOrLater }
  156.  {$IFC GENERATINGCFM }
  157. {$SETC SystemSevenOrLater := 1}
  158.  {$ELSEC}
  159. {$SETC SystemSevenOrLater := SystemSevenFiveOrLater}
  160.  {$ENDC}
  161. {$ENDC}
  162. {$IFC UNDEFINED SystemSixOrLater }
  163. {$SETC SystemSixOrLater := SystemSevenOrLater}
  164. {$ENDC}
  165. {
  166.  
  167.     Set up OLDROUTINENAMES and OLDROUTINELOCATIONS
  168.  
  169. }
  170. {$IFC UNDEFINED OLDROUTINENAMES }
  171. {$SETC OLDROUTINENAMES := 1}
  172. {$ENDC}
  173. {$IFC UNDEFINED OLDROUTINELOCATIONS }
  174. {$SETC OLDROUTINELOCATIONS := 1}
  175. {$ENDC}
  176.  
  177. {$SETC UsingIncludes := ConditionalMacrosIncludes}
  178.  
  179. {$ENDC} {__CONDITIONALMACROS__}
  180.  
  181. {$IFC NOT UsingIncludes}
  182.  END.
  183. {$ENDC}
  184.